Skip to content

Propagate Union nullability to its variants#8768

Draft
connortsui20 wants to merge 1 commit into
developfrom
codex/union-nullability-propagation
Draft

Propagate Union nullability to its variants#8768
connortsui20 wants to merge 1 commit into
developfrom
codex/union-nullability-propagation

Conversation

@connortsui20

Copy link
Copy Markdown
Member

Rationale for this change

A Union has no top-level nullability of its own; its nullability is derived from its variant dtypes. Generic DType::as_nullable and DType::as_nonnullable therefore need to propagate the requested nullability into every variant rather than returning the union unchanged.

This is split from #8739 so the DType behavior can be reviewed independently from UnionScalar support.

What changes are included in this PR?

  • make DType::with_nullability propagate through UnionVariants
  • add UnionVariants::with_nullability
  • cover nullable and non-nullable round trips at the dtype layer

What APIs are changed? Are there any user-facing changes?

UnionVariants::with_nullability is a new public API. Calling DType::as_nullable, DType::as_nonnullable, or DType::with_nullability on a union now updates every variant dtype.

Validation

  • cargo nextest run -p vortex-array test_with_nullability_propagates_to_variants
  • cargo +nightly fmt --all -- --check
  • cargo clippy -p vortex-array --all-targets --all-features

Workspace-wide Clippy could not complete locally because the DuckDB build could not find duckdb.h.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
@connortsui20 connortsui20 mentioned this pull request Jul 15, 2026
@connortsui20

Copy link
Copy Markdown
Member Author

#8769

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant